package com.malty.mall.domain.entity.ums;


import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.annotation.TableName;
import com.malty.mall.domain.dto.req.UmsRoleParam;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * @author malty
 */
@Data
@NoArgsConstructor
@TableName("ums_role")
public class UmsRole {
    private Integer id;
    private String roleName;
    private String description;
    private Integer count;
    private Integer status;
    private Date createTime;
    private Date updateTime;

    public UmsRole(UmsRoleParam umsRoleParam) {
        BeanUtil.copyProperties(umsRoleParam,this);
    }

    public static List<UmsRoleParam> getParamBatch(List<UmsRole> roleList) {
        List<UmsRoleParam> roleParams = new ArrayList<>();
        for (UmsRole umsRole : roleList) {
            roleParams.add(new UmsRoleParam(umsRole));
        }
        return roleParams;
    }
}
